/**
* Created by wl
* 基金储备库-项目储备信息
*/
<template>
    <div class="ca-p-20">
        <div v-if="!showEdit">
            <div class="ca-title">
                <el-button type="text"  class="ca-edit-btn el-icon-edit ca-right" @click="showEdit = true" :disabled="!isAuthEditPre" v-if="$route.name.includes('pre-investment-funds')">编辑</el-button>
                <el-button type="text" class="ca-edit-btn el-icon-edit ca-right" @click="showEdit=true" :disabled="!isAuthEdit" v-else>编辑</el-button>
            </div>
            <el-table
                :data='itemInfo.itemHoldHighManagerEntities'
                class="ca-table table_p_01 el-wid-100">
                <el-table-column
                    label="项目名称"
                    prop="itemName">
                    <template slot-scope="scope">
                        <el-tooltip effect="dark" :content="scope.row.itemName" placement="top" v-if="scope.row.itemName">
                            <el-button type="text" class="ca-notes ca-text-over-flow-ellipsis">{{scope.row.itemName}}</el-button>
                        </el-tooltip>
                    </template>
                </el-table-column>
                <el-table-column
                    label="公司名称"
                    prop="company">
                    <template slot-scope="scope">
                        <el-tooltip effect="dark" :content="scope.row.company" placement="top" v-if="scope.row.company">
                            <el-button type="text" class="ca-notes ca-text-over-flow-ellipsis">{{scope.row.company}}</el-button>
                        </el-tooltip>
                    </template>
                </el-table-column>
                <el-table-column
                    label="行业"
                    prop="industry">
                    <template slot-scope="scope">
                        <el-tooltip effect="dark" :content="scope.row.industry" placement="top" v-if="scope.row.industry">
                            <el-button type="text" class="ca-notes ca-text-over-flow-ellipsis">{{scope.row.industry}}</el-button>
                        </el-tooltip>
                    </template>
                </el-table-column>
                <el-table-column
                    label="地域"
                    prop="region">
                    <template slot-scope="scope">
                        <el-tooltip effect="dark" :content="scope.row.region" placement="top" v-if="scope.row.region">
                            <el-button type="text" class="ca-notes ca-text-over-flow-ellipsis">{{scope.row.region}}</el-button>
                        </el-tooltip>
                    </template>
                </el-table-column>
                <el-table-column
                    label="阶段"
                    prop="stage">
                    <template slot-scope="scope">
                        <el-tooltip effect="dark" :content="scope.row.stage" placement="top" v-if="scope.row.stage">
                            <el-button type="text" class="ca-notes ca-text-over-flow-ellipsis">{{scope.row.stage}}</el-button>
                        </el-tooltip>
                    </template>
                </el-table-column>
                <el-table-column
                    label="成立时间"
                    prop="establishTime">
                    <template slot-scope="scope">
                        {{scope.row.establishTime == null ? '' : $moment(scope.row.establishTime).format('YYYY-MM-DD')}}
                    </template>
                </el-table-column>
                <el-table-column
                    prop="investment"
                    label="计划投资金额</br>（万元）"
                    :render-header="renderTitle"
                    align="center">
                </el-table-column>
                <el-table-column
                    label="备注"
                    prop="remarks">
                    <template slot-scope="scope">
                        <el-tooltip class="item" effect="dark" :content="scope.row.remarks" placement="top" v-if="scope.row.remarks">
                            <el-button type="text" class="ca-notes ca-text-over-flow-ellipsis">{{scope.row.remarks}}</el-button>
                        </el-tooltip>
                    </template>
                </el-table-column>
            </el-table>
        </div>
        <csFundInfo v-else @close="showEdit = false" @update='update'></csFundInfo>
    </div>
</template>
<script type="text/ecmascript-6">
    import {api} from '../../api';
    import {STATUS_HTTP_SUCCESS, apiHttp} from '__service/csHttp';
    import { addRemind, isNoAuth } from '__service/utils';
    export default {
        data() {
            return {
                showEdit: false,
                isAuthEdit: isNoAuth('基金储备库-基金详情-编辑'),
                isAuthEditPre: isNoAuth('拟投资基金-基金详情-编辑'),
                dialogVisible: false,
                itemInfo: {
                    itemHoldHighManagerEntities: [],
                },
            }
        },
        created() {
        },
        mounted() {
            this.getInfo()
        },
        props: {

        },
        watch: {
        },
        methods: {
            async update() {
                this.showEdit = false
                await this.getInfo()
                // 添加小红点
                await addRemind({
                    dataId: this.$route.params.itemId, // 业务id
                    dataTab: 0, // tab页顺序 head 也为0 新建为'-1'
                    dataType: 4, // 1拟投资项目,2已投资项目,3母基金,4拟设立基金,5已设立基金,6客户,7潜在项目
                });
                // 根据第三方组件来调用 父组件中定义的方法 重新获取小红点
                this.$root.Dot.$emit('getDotList');
                // 添加小红点 end
            },
            getInfo() {
                apiHttp(api.CHECK_PROJECTRESERVE, {id: this.$route.params.itemId}).then(ret=> {
                    if (ret.resCode === STATUS_HTTP_SUCCESS) {
                        this.itemInfo.itemHoldHighManagerEntities = ret.data
                        // console.log(ret,'get')
                    }
                })
            },
        },
        components: {
            'csFundInfo': require('./edit'),//基金信息edit页
        },
    }
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.ca-right {
    float: right;
}
.ca-table th {
    line-height: 20px;
}
.ca-notes {
    color: #666;
}
</style>